export default { 
	getPackageConfig(){
		return this.vm.$u.post('/user/getPackageConfig', {}, {useStoreApi: true});
	},
	becomeRecommender(params){
		return this.vm.$u.post('/user/payRecommend', params, {useStoreApi: true});
	},
	getIntroduce(){
		return this.vm.$u.post('/user/introduce', {}, {useStoreApi: true});
	},
	getUploadUrl(){
		return "https://admin.cqycgyl.com/api/common/upload"
	},
	getUploadHeader(){ 
		return {
			"token":this.vm.vuex_token,
		} 	
	},
	//获取用户数据
	getUserData(params){
		return this.vm.$u.post('/user/getUserData', params, {useStoreApi: true});
	},
	// 手机号登录
	UserLogin(params){
		return this.vm.$u.post('/user/UserLogin', params, {useStoreApi: true});
	},
	getWxOpenId(params) {
		return this.vm.$u.post('/user/getOpenid', params, {useStoreApi: true});
	},
	//修改用户信息
	updateUserInfo(params){
		return this.vm.$u.post("/applet/user/updateUserInfo", params)
	},
	// 上传银行卡
	updateBank(params){
		return this.vm.$u.post("/user/getuserbank", params,{useStoreApi: true})
	},
	//上传图片
	uploadImg(obj){
		 let _this = this
		 let loading = obj?.loading ?? false
		 if(loading){
		 	uni.showLoading({
		 		title: '上传中'
		 	});
		 } 
		 return new Promise((ret,rej) => { 
		 	uni.uploadFile({
		 		url:_this.baseUrl + "/applet/user/uploadImg",
		 		filePath: obj?.file ?? null,
		 		name: obj?.name ?? 'file',
		 		formData: obj?.data ?? null, 
				header:{
					"token":_this.vm.vuex_token
				},
		 		success:function(res){
		 			if(res.statusCode != 200){
		 				return rej(res)
		 			} 
		 			let data = {}
		 			try{
		 				data = JSON.parse(res.data)
		 			}catch(e){ 
		 			}
		 			return ret(data)
		 		},
		 		fail:function(err){
		 			return rej(err)
		 		},
		 		complete:function(){
		 			if(loading){
		 				uni.hideLoading();
		 			}
		 		}
		 	});
		 }) 
	 },
	 withdraw(params){
		return this.vm.$u.post("/user/withdraw", params,{loading:true})
	 },
	 getWithdrawList(params){
		return this.vm.$u.post("/user/getWithdrawList", params,{loading:true}) 
	 },
	 getRechargeList(params){
	 	return this.vm.$u.post("/applet/user/getRechargeList", params,{loading:true}) 
	 },
	 getUserBank(){
		return this.vm.$u.post("/user/userbanklist", {},{useStoreApi: true})
	 },
	 weixin_prepay(params){
		return this.vm.$u.post("/user/weixin_prepay", params,{loading:true})
	 },
	 // 确认收款
	 confirmWithdraw(params){
		return this.vm.$u.post("/user/confirmWithdraw", params,{loading:true})
	 },
	 //获取最近获得的券
	 getRecentCoupon(params){
		return this.vm.$u.post("/store/get_recent_coupon", {},{useStoreApi: true})
	 },
	 bindCoupon(params){	
		return this.vm.$u.post("/user/bindCoupon", params,{useStoreApi: true})
	 },
	 cancelConfirm(params){
		return this.vm.$u.post("/user/cancelConfirm", params,{useStoreApi: true})
	 },
	  //支付宝提现
	  alipayWithdraw(params){
		return this.vm.$u.post("/user/ali_withdraw", params,{useStoreApi: true})
	 },
	 getCart(params){
		return this.vm.$u.post("/merchant/getCart", params,{useStoreApi: true})
	 },
	 getBankIcon(bank_name){
		return this.vm.$u.post("/user/getBankIcon", {bank_name}, {useStoreApi: true})
	 },
	 codeLogin(params){
		return this.vm.$u.post("/user/CodeLogin", params,{useStoreApi: true})
	 },
	 
}